package com.olympus.hermes.bean.dto.member;

import com.olympus.hermes.common.bean.AbstractBeanConvert;
import com.olympus.hermes.domain.Member;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;

/**
 * @author Mickey
 * @since 2021/2/1
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class CreateMemberDTO extends AbstractBeanConvert<CreateMemberDTO, Member> {

    @Override
    protected Member doForward(CreateMemberDTO createMemberDTO) {
        Member member = new Member();
        member.setUsername(createMemberDTO.getUsername());
        member.setPassword(createMemberDTO.getPassword());
        member.setNickname(createMemberDTO.getNickname());
        return member;
    }

    @Override
    protected CreateMemberDTO doBackward(Member member) {
        return null;
    }

    @NotBlank(message = "用户名不能空")
    private String username;

    @NotBlank(message = "密码不能为空")
    private String password;

    @NotBlank(message = "用户昵称不能为空")
    private String nickname;
}
